<link rel="stylesheet" type="text/css" href="mycss/redBtn.css" />
<link rel="stylesheet" type="text/css" href="mycss/tooltip.css" />
<?php require("check_login.php"); ?>
<?php require("user_settings.php"); ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<style>
label, textarea{
  display:inline-block;
  vertical-align:middle;

}
form {
	margin: 1em 0 0 1.5em;
}
label {
	float: left;
	width: 100px;
	margin-left: 1em;
}
p {
	clear: both;
}
fieldset {
margin: 1.5em 0em 0em 1.5em;
padding: 0;
border: 1px solid #CCC;
width: 600px;
}
legend {
margin-left: 1em;
color: #009;
font-weight: bold;
}
</style>
<style> 
.myinput{
	border: #C0C0C0 1px solid;
	border-radius: 5px;
	/** remember to change image path **/
	background: url(none) no-repeat #ffffff;
	font-family: tahoma, helvetica, sans-serif;
	font-style: normal;
	font-size: 14px;
	color: #454743;
}

 </style> 
<style type="text/css">
body{
    font-family: Cambria, Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
    background: #fff url(images/bg.jpg) repeat top left;
    font-weight: 400;
    font-size: 15px;
    color: #1d3c41;
    overflow-y: scroll;
}
</style>
<?php
$uid=$_SESSION['id'];
	#$user_file = "users/".$uid."/settings.json";
	#$users = json_decode(file_get_contents($user_file),true);
	$users = getUser($uid);
	if(!isset($users['cname'])) {
		$users['cname'] = $uid;
	}
	if(!isset($users['rpass'])) {
		$users['rpass'] = "unspecified";
	}
	if(!isset($users['email'])) {
		$users['email'] = "unspecific@localhost";
	}
	if(!isset($users['age'])) {
		$users['age'] = "unspecified";
	}
	if(!isset($users['job'])) {
		$users['job'] = "unspecified";
	}
	if(!isset($users['expertise'])) {
		$users['expertise'] = "Linux driver programming";
	}
	if(!isset($users['brief'])) {
		$users['brief'] = "unsepcified";
	}
	if(!isset($users['identity'])) {
		$users['identity'] = "student";
	}


	if(isset($_GET['cname']))
		$users['cname'] = htmlspecialchars($_GET['cname']);
	if(isset($_GET['rpass']))
		$users['rpass'] = htmlspecialchars($_GET['rpass']);
	if(isset($_GET['email']))
		$users['email'] = htmlspecialchars($_GET['email']);
	#file_put_contents("$user_file",json_encode($users));
	setUser($uid,$users);

?>
<?php
	#if(file_exists("users/".$uid."/pic.jpg")) {
	#	echo "<img src=users/".$uid."/pic.jpg width=160 height=120>";
	#} 
	#else
	#	echo "Photo not update<BR>";
?>
<!--
<form id="uploadform" action="upload_pic.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
-->

<form name="settings" action="mycompany.php">
	<input type=hidden name=savePref value=yes>
	<input type=hidden name=uid value=$uid>
<?php
	#echo "<input type=hidden name=uid value=$uid>";
	$msg = "【公司代碼】和【瀏覽密碼】為一組帳號密碼，提供您公司成員登入瀏覽模式來查看您輸入的資料";
	echo "公司代碼: ".$users['cid']."<BR>";
	echo "公司名稱: <Input type=text name=cname class='myinput'value=\"".$users['cname']."\"><BR>";
	echo "瀏覽密碼: <Input type=text name=rpass class='myinput' value=\"".$users['rpass']."\"> ";
	echo "<a class='tooltips' href=# onclick=\"window.open('index.php');\">[?]<span style='width:300px; height: 70px;' >$msg</span></a><BR>";
	echo "電子信箱: <Input type=text name=email class='myinput' value=\"".$users['email']."\"><BR>";
	#echo "Age: <Input type=text name=age value=\"".$users['age']."\"><BR>";
	#echo "Job: <Input type=text name=job value=\"".$users['job']."\"><BR>";
	#echo "Identity: <Input type=text name=identity value=\"".$users['identity']."\"><BR>";
	#echo "Expertise: <Input type=text name=expertise value=\"".$users['expertise']."\"><BR>";
	#//echo "Brief: <Input type=text name=brief value=\"".$users['brief']."\"><BR>";
	#echo "Brief: <textarea name=\"brief\" rows=5 cols=80>";
	#echo $users['brief'];
	#echo "</textarea>";
?>
	<BR>
	<input type=submit value="儲存" class='redBtn'>
</form>
